//
//  LOLSetTableViewController.m
//  LOLer
//
//  Created by kaijie on 16/3/29.
//  Copyright © 2016年 kaijie. All rights reserved.
//

#import "LOLSetTableViewController.h"
#import "LOLProgressHUD.h"

@interface LOLSetTableViewController ()<MBProgressHUDDelegate>{
    UIView*viewOfTableViewFootView;
}
S_property(UIButton, buttonOfOut)
S_property(NSString, cellText)
@end

@implementation LOLSetTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor colorWithRed:236/255.0 green:234/255.0 blue:242/255.0 alpha:1.0];
    self.title=@"设置";
    self.tableView.scrollEnabled=NO;
    self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;
    [self.navigationController.navigationBar setTintColor:OVERALLCOLOR];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)viewWillAppear:(BOOL)animated {
    
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    switch (section) {
        case 0:
            return 1;
            break;
        case 1:
            return 4;
            break;
        case 2:
            return 2;
            break;
        default:
            return 0;
            break;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell*cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    
    switch (indexPath.section) {
        case 0:
            cell.textLabel.text=@"绑定大区";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.detailTextLabel.text = @"黑色玫瑰";
            break;
        case 1:
            switch (indexPath.row) {
                case 0:
                    cell.textLabel.text=@"消息推送设置";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    break;
                case 1:
                    cell.textLabel.text=@"隐私设置";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    break;
                case 2:
                    cell.textLabel.text=@"省流量";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    cell.detailTextLabel.text=@"资讯图片自动下载设置";
                    break;
                default:
                    cell.textLabel.text=@"清空缓存";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    cell.detailTextLabel.text=self.cellText;
                    break;
                }
            break;
           
        default:
            switch (indexPath.row) {
                case 0:
                    cell.textLabel.text=@"关于掌盟";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    break;
                    
                default:
                    cell.textLabel.text=@"意见反馈";
                    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
                    cell.detailTextLabel.text=@"官方反馈QQ群:332461184";
                    break;
            }
            break;
    }
    
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    
    return cell;
}
//-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section{
//    return 10;
//    
//}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 15;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==1&&indexPath.row==3) {
   LOLProgressHUD*HUD=[LOLProgressHUD showHUDAddedTo:self.view animated:YES];
    HUD.delegate=self;
    [HUD setPropertyLabelText:nil DetailsLabelText:@"笑笑" DimBackground:YES];
    [HUD hide:YES afterDelay:1];
        
    }
    
}
-(NSString *)cellText{
    if (!_cellText) {
        _cellText=@"333.21KB";
    }return _cellText;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
 
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
